
package com.tros.customer.features;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.Date;

public class UpdateBillPay {
	
	String accNo;
	String accType;
	String transType;
	String amount;
	String custID;
	String billType;
	String ser;
	String billAmt;
	
	
	Connection connect =null;
	
	UpdateBillPay(Connection connect, String No, String Type, String billType, String billAmt,String ser,String custID){
		
		this.accNo = No;
		this.accType = Type;
		this.billType =billType;
		this.billAmt = billAmt;
		this.ser = ser;
		this.custID = custID;
	}
	
	void updateTransValues(){
		
		try{
			
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
		    connect =DriverManager.getConnection("jdbc:odbc:bank","root", " ");
			  
		    PreparedStatement state1=connect.prepareStatement("INSERT INTO PAYTRANS VALUES(?,?,?,?,?,?,?)");   
		    state1.setString(1,accNo);
		    state1.setString(2,accType);
		    state1.setString(3,new java.text.SimpleDateFormat("MM/dd/yyyy h:mm:ss a").format(new Date()));
		    state1.setString(4,billType);
		    state1.setString(5,billAmt);
		    state1.setString(6,ser);
		    state1.setString(7,custID);
		    
		    state1.executeUpdate();	
		    state1.close();
		    
		    connect.close();
		  
	}catch(Exception e)
	{
		System.out.println("Failed here update amount --------->");
		e.printStackTrace();
	}
		
	}

}
